﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace EnterpriseFund.DAL
{
    /// <summary>
    /// 数据访问类:DJ_OTHER_NSRXX
    /// </summary>
    public partial class DJ_OTHER_NSRXX
    {
        public DJ_OTHER_NSRXX()
        { }
        #region  BasicMethod

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public decimal Add(EnterpriseFund.Model.DJ_OTHER_NSRXX model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into fund.t_DJ_OTHER_NSRXX(");
            strSql.Append("NSRDZDAH,GS_NSRSBH,GS_NSRMC,FEntityNo)");
            strSql.Append(" values (");
            strSql.Append("@NSRDZDAH,@GS_NSRSBH,@GS_NSRMC,@FEntityNo)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
					new SqlParameter("@NSRDZDAH", SqlDbType.Decimal,4),
					new SqlParameter("@GS_NSRSBH", SqlDbType.NVarChar,20),
					new SqlParameter("@GS_NSRMC", SqlDbType.NVarChar,80),
					new SqlParameter("@FEntityNo", SqlDbType.NVarChar,255)};
            parameters[0].Value = model.NSRDZDAH;
            parameters[1].Value = model.GS_NSRSBH;
            parameters[2].Value = model.GS_NSRMC;
            parameters[3].Value = model.FEntityNo;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToDecimal(obj);
            }
        }
        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}

